/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package data.impl;

import data.DataPackage;
import data.MapObject;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Map Object</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link data.impl.MapObjectImpl#getX <em>X</em>}</li>
 *   <li>{@link data.impl.MapObjectImpl#getY <em>Y</em>}</li>
 *   <li>{@link data.impl.MapObjectImpl#getXWidth <em>XWidth</em>}</li>
 *   <li>{@link data.impl.MapObjectImpl#getYWidth <em>YWidth</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MapObjectImpl extends EObjectImpl implements MapObject {
	/**
	 * The default value of the '{@link #getX() <em>X</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getX()
	 * @generated
	 * @ordered
	 */
	protected static final double X_EDEFAULT = 0.0;

	/**
	 * The cached value of the '{@link #getX() <em>X</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getX()
	 * @generated
	 * @ordered
	 */
	protected double x = X_EDEFAULT;

	/**
	 * The default value of the '{@link #getY() <em>Y</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getY()
	 * @generated
	 * @ordered
	 */
	protected static final double Y_EDEFAULT = 0.0;

	/**
	 * The cached value of the '{@link #getY() <em>Y</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getY()
	 * @generated
	 * @ordered
	 */
	protected double y = Y_EDEFAULT;

	/**
	 * The default value of the '{@link #getXWidth() <em>XWidth</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getXWidth()
	 * @generated
	 * @ordered
	 */
	protected static final double XWIDTH_EDEFAULT = 0.0;

	/**
	 * The cached value of the '{@link #getXWidth() <em>XWidth</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getXWidth()
	 * @generated
	 * @ordered
	 */
	protected double xWidth = XWIDTH_EDEFAULT;

	/**
	 * The default value of the '{@link #getYWidth() <em>YWidth</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getYWidth()
	 * @generated
	 * @ordered
	 */
	protected static final double YWIDTH_EDEFAULT = 0.0;

	/**
	 * The cached value of the '{@link #getYWidth() <em>YWidth</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getYWidth()
	 * @generated
	 * @ordered
	 */
	protected double yWidth = YWIDTH_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MapObjectImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DataPackage.Literals.MAP_OBJECT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getX() {
		return x;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setX(double newX) {
		double oldX = x;
		x = newX;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.MAP_OBJECT__X, oldX, x));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getY() {
		return y;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setY(double newY) {
		double oldY = y;
		y = newY;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.MAP_OBJECT__Y, oldY, y));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getXWidth() {
		return xWidth;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setXWidth(double newXWidth) {
		double oldXWidth = xWidth;
		xWidth = newXWidth;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.MAP_OBJECT__XWIDTH, oldXWidth, xWidth));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public double getYWidth() {
		return yWidth;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setYWidth(double newYWidth) {
		double oldYWidth = yWidth;
		yWidth = newYWidth;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.MAP_OBJECT__YWIDTH, oldYWidth, yWidth));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case DataPackage.MAP_OBJECT__X:
				return getX();
			case DataPackage.MAP_OBJECT__Y:
				return getY();
			case DataPackage.MAP_OBJECT__XWIDTH:
				return getXWidth();
			case DataPackage.MAP_OBJECT__YWIDTH:
				return getYWidth();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case DataPackage.MAP_OBJECT__X:
				setX((Double)newValue);
				return;
			case DataPackage.MAP_OBJECT__Y:
				setY((Double)newValue);
				return;
			case DataPackage.MAP_OBJECT__XWIDTH:
				setXWidth((Double)newValue);
				return;
			case DataPackage.MAP_OBJECT__YWIDTH:
				setYWidth((Double)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case DataPackage.MAP_OBJECT__X:
				setX(X_EDEFAULT);
				return;
			case DataPackage.MAP_OBJECT__Y:
				setY(Y_EDEFAULT);
				return;
			case DataPackage.MAP_OBJECT__XWIDTH:
				setXWidth(XWIDTH_EDEFAULT);
				return;
			case DataPackage.MAP_OBJECT__YWIDTH:
				setYWidth(YWIDTH_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case DataPackage.MAP_OBJECT__X:
				return x != X_EDEFAULT;
			case DataPackage.MAP_OBJECT__Y:
				return y != Y_EDEFAULT;
			case DataPackage.MAP_OBJECT__XWIDTH:
				return xWidth != XWIDTH_EDEFAULT;
			case DataPackage.MAP_OBJECT__YWIDTH:
				return yWidth != YWIDTH_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (x: ");
		result.append(x);
		result.append(", y: ");
		result.append(y);
		result.append(", xWidth: ");
		result.append(xWidth);
		result.append(", yWidth: ");
		result.append(yWidth);
		result.append(')');
		return result.toString();
	}

} //MapObjectImpl
